﻿
using Southridge.Data;
using Southridge.View;
using System.Windows.Input;
using System.Windows;

namespace Southridge.View 
{ 
    public class ListingDetailsViewModel  : BusinessEntity 
    {
        public ListingDetailsViewModel(Listing listing, Profile profile)
        {
            Listing = listing;
            CurrentCustomer = profile; 
        } 
        private Listing _listing;
        private Profile _currentCustomer; 
        private ICommand _createAppointmentCommand; 
        
        public Listing Listing 
        { 
            get 
            {
                return _listing; 
            } 
            private set 
            {
                if (_listing != value )
                {
                    _listing = value;
                    OnPropertyChanged("Listing"); 
                } 
            } 
        }

        public Profile CurrentCustomer
        {
            get
            {
                return _currentCustomer;
            }
            private set
            {
                if (_currentCustomer != value)
                {
                    _currentCustomer = value;
                    OnPropertyChanged("Profile");
                }
            }   
        } 

        public ICommand CreateAppointmentCommand
        {
            get
            {
                if (_createAppointmentCommand == null)
                {
                    _createAppointmentCommand = new DelegateCommand<object>(OnCreateAppointmentCommand, false); 
                }
                return _createAppointmentCommand; 
            } 
        }

        protected void OnCreateAppointmentCommand(object o)
        {
            //TODO: ViewModel should not popup boxes.. 
            //but poppint it here since this is not implemented. 
            MessageBox.Show("OnCreateAppt is not implemented, but the commands have been wired."); 
        } 
    } 
} 